+++ /dev/null
-From: Simon McVittie <smcv@collabora.com>
-Date: Sun, 18 Apr 2021 12:16:45 +0100
-Subject: libtest: On failure, make it clearer what has happened
-
-If we fail as a result of `set -x`, It's often not completely obvious
-which command failed or how. Use a trap on ERR to show the command that
-failed, and its exit status.
-
-Signed-off-by: Simon McVittie <smcv@collabora.com>
-Forwarded: https://github.com/ostreedev/ostree/pull/2350
-Applied-upstream: 2021.3, commit:9d48d39a4b16c4faa58488107cd0a53c8144a7ca
----
- tests/libtest.sh | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/tests/libtest.sh b/tests/libtest.sh
-index eda3b92..2e9a99d 100755
---- a/tests/libtest.sh
-+++ b/tests/libtest.sh
-@@ -46,6 +46,14 @@ run_exit_cmds() {
- }
- trap run_exit_cmds EXIT
-
-+report_err () {
-+ local exit_status="$?"
-+ { { local BASH_XTRACEFD=3; } 2> /dev/null
-+ echo "Unexpected nonzero exit status $exit_status while running: $BASH_COMMAND" >&2
-+ } 3> /dev/null
-+}
-+trap report_err ERR
-+
- save_core() {
- if [ -e core ]; then
- cp core "$test_srcdir/core"
+++ /dev/null
-From: Dan Nicholson <dbn@endlessos.org>
-Date: Mon, 19 Apr 2021 11:00:20 -0600
-Subject: tests: Test without a cache directory by default
-
-Several tests generate summaries and then expect to use the generated
-summary immediately. However, this can cause intermittent test failures
-when they inadvertantly get a cached summary file. This typically
-happens when the test is run on a filesystem that doesn't support user
-extended attributes. In that case, the caching code can only use the
-last modified time, which only has 1 second granularity. If tests don't
-carefully manage the summary modification times or the repo cache then
-they are likely subject to races in some test environments.
-
-This introduces an environment variable `OSTREE_SKIP_CACHE` that
-prevents the repo from using a cache directory. This is enabled by
-default in tests and disabled for tests that are a explicitly trying to
-test the caching behavior.
-
-Bug: https://github.com/ostreedev/ostree/issues/2313
-Bug: https://github.com/ostreedev/ostree/issues/2351
-Forwarded: https://github.com/ostreedev/ostree/pull/2352
-Applied-upstream: 2021.3, commit:e660855796a40ad417d13cbe081bd62e56a1c6f5
----
- src/libostree/ostree-repo.c | 2 +-
- tests/libtest.sh | 5 +++++
- tests/test-pull-summary-caching.sh | 3 +++
- tests/test-pull-summary-sigs.sh | 3 +++
- tests/test-signed-pull-summary.sh | 3 +++
- 5 files changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
-index b2347b4..76b0248 100644
---- a/src/libostree/ostree-repo.c
-+++ b/src/libostree/ostree-repo.c
-@@ -3291,7 +3291,7 @@ ostree_repo_open (OstreeRepo *self,
- if (!glnx_opendirat (self->repo_dir_fd, "tmp", TRUE, &self->tmp_dir_fd, error))
- return FALSE;
-
-- if (self->writable)
-+ if (self->writable && getenv ("OSTREE_SKIP_CACHE") == NULL)
- {
- if (!glnx_shutil_mkdir_p_at (self->tmp_dir_fd, _OSTREE_CACHE_DIR, DEFAULT_DIRECTORY_MODE, cancellable, error))
- return FALSE;
-diff --git a/tests/libtest.sh b/tests/libtest.sh
-index 2e9a99d..40f362b 100755
---- a/tests/libtest.sh
-+++ b/tests/libtest.sh
-@@ -86,6 +86,11 @@ unset TAR_OPTIONS
- # easily clean up.
- export OSTREE_SYSROOT_DEBUG=mutable-deployments
-
-+# By default, don't use a cache directory since it makes the tests racy.
-+# Tests that are explicitly testing the cache operation should unset
-+# this.
-+export OSTREE_SKIP_CACHE=1
-+
- export TEST_GPG_KEYID_1="7FCA23D8472CDAFA"
- export TEST_GPG_KEYFPR_1="5E65DE75AB1C501862D476347FCA23D8472CDAFA"
- export TEST_GPG_KEYID_2="D8228CFECA950D41"
-diff --git a/tests/test-pull-summary-caching.sh b/tests/test-pull-summary-caching.sh
-index 9671199..37c2aed 100755
---- a/tests/test-pull-summary-caching.sh
-+++ b/tests/test-pull-summary-caching.sh
-@@ -31,6 +31,9 @@ if ! has_gpgme; then
- exit 0
- fi
-
-+# Ensure repo caching is in use.
-+unset OSTREE_SKIP_CACHE
-+
- COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
-
- echo "1..1"
-diff --git a/tests/test-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh
-index 3819cbf..04a8e48 100755
---- a/tests/test-pull-summary-sigs.sh
-+++ b/tests/test-pull-summary-sigs.sh
-@@ -23,6 +23,9 @@ set -euo pipefail
-
- . $(dirname $0)/libtest.sh
-
-+# Ensure repo caching is in use.
-+unset OSTREE_SKIP_CACHE
-+
- COMMIT_SIGN=""
- if has_gpgme; then
- COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
-diff --git a/tests/test-signed-pull-summary.sh b/tests/test-signed-pull-summary.sh
-index e953f2e..3d46869 100755
---- a/tests/test-signed-pull-summary.sh
-+++ b/tests/test-signed-pull-summary.sh
-@@ -27,6 +27,9 @@ set -euo pipefail
-
- echo "1..14"
-
-+# Ensure repo caching is in use.
-+unset OSTREE_SKIP_CACHE
-+
- # This is explicitly opt in for testing
- export OSTREE_DUMMY_SIGN_ENABLED=1
-